﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using DataLayer.Controller;

public partial class HistoryPayment : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            grvDocumento.DataSource = ClientController.GetHistory(Request.Params["NIT"]);
            grvDocumento.DataBind();

        }
    }

    protected void grvDocumento_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            HyperLink hplDocumento = (HyperLink)e.Row.FindControl("hplDocumento");
            hplDocumento.NavigateUrl = ConfigurationManager.AppSettings["urlSoporte"].ToString() + DataBinder.Eval(e.Row.DataItem, "numero_documento").ToString().Trim() + "_" + DateTime.Parse(DataBinder.Eval(e.Row.DataItem, "fecha_pago").ToString()).ToString("ddMMyyyy") + ".pdf";
        }
    }


    protected void btnBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect(ConfigurationManager.AppSettings["urlPortal"] + "client/StateAccount.aspx?NIT=" + Request.Params["NIT"].ToString() + "&usrNombre=" + Request.Params["usrNombre"].ToString());
    }
}
